package com.hksj.Intelligentmanagement.mqtt.listener;

import com.hksj.Intelligentmanagement.mqtt.annotation.MqttSubscription;
import org.eclipse.paho.client.mqttv3.MqttMessage;

//@MqttConfiguration
public class MsgListenerConfig {

    @MqttSubscription(topics = {"/123/#"})
    public void test(String topic, MqttMessage mqttMessage){
        System.out.println(new String(mqttMessage.getPayload()));

    }

    @MqttSubscription(topics = {"/456/#"})
    public void test2(String topic, MqttMessage mqttMessage){
        System.out.println("test2");
    }

    @MqttSubscription(topics = {"/456/2/#"})
    public void test3(String topic, MqttMessage mqttMessage){
        try {
            Thread.sleep(1000 * 60 );
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("thread-name =====> " + Thread.currentThread().getName());
    }

    @MqttSubscription(topics = {"$SYS/brokers/+/clients/45/#"})
    public void test4(String topic, MqttMessage mqttMessage){
        System.out.println("test2");
    }
}
